<template>
  <el-dialog
    :visible.sync="visible"
    :close-on-click-modal="false"
    :before-close="beforeClose"
    append-to-body
    top="30px"
    width="1000px"
  >
    <el-tabs v-model="active">
      <el-tab-pane label="基本信息" name="detail">
        <project-detail :query-id="queryId"></project-detail>
      </el-tab-pane>
      <el-tab-pane label="相关附件" name="attach">
        <project-attach :query-id="queryId" :view-mode="true"></project-attach>
      </el-tab-pane>
    </el-tabs>
  </el-dialog>
</template>

<script>
import ProjectDetail from '@/bank/views/limit/ProjectDetail'
import ProjectAttach from '@/bank/views/business/industry/new/attach/Attach'

export default {
  components: {
    ProjectDetail,
    ProjectAttach,
  },
  props: {
    visible: Boolean,
    queryId: String,
    batchNo: {
      type: [String, Array],
      default: () => '',
    },
    tabName: {
      type: String,
      default: 'detail',
    },
  },
  data() {
    return {
      active: 'detail',
    }
  },
  watch: {
    tabName: {
      handler: function () {
        this.reset()
      },
      immediate: true,
    },
  },
  created() {},
  methods: {
    beforeClose() {
      this.reset()
      this.$emit('update:visible', false)
    },

    reset() {
      this.active = this.tabName || 'detail'
    },
  },
}
</script>
<style lang="scss" scoped></style>
